{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "toc": true
   },
   "source": [
    "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
    "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#面部识别（人脸识别部分）\" data-toc-modified-id=\"面部识别（人脸识别部分）-1\"><span class=\"toc-item-num\">1&nbsp;&nbsp;</span>面部识别（人脸识别部分）</a></span><ul class=\"toc-item\"><li><span><a href=\"#面部检测\" data-toc-modified-id=\"面部检测-1.1\"><span class=\"toc-item-num\">1.1&nbsp;&nbsp;</span>面部检测</a></span></li><li><span><a href=\"#json转译\" data-toc-modified-id=\"json转译-1.2\"><span class=\"toc-item-num\">1.2&nbsp;&nbsp;</span>json转译</a></span></li><li><span><a href=\"#pandas-数据表格化\" data-toc-modified-id=\"pandas-数据表格化-1.3\"><span class=\"toc-item-num\">1.3&nbsp;&nbsp;</span>pandas 数据表格化</a></span></li><li><span><a href=\"#数据取值\" data-toc-modified-id=\"数据取值-1.4\"><span class=\"toc-item-num\">1.4&nbsp;&nbsp;</span>数据取值</a></span></li></ul></li></ul></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 面部识别（人脸识别部分）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 面部检测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'{\"error\": {\"code\": \"InvalidImage\", \"message\": \"Decoding error, image format unsupported.\"}}'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " # A-1 面部检测\n",
    "import requests\n",
    "import json\n",
    "\n",
    "# set to your own subscription key value\n",
    "subscription_key = \"7be210d7eecb494da6f7e5bb3fb977d6\"\n",
    "assert subscription_key\n",
    "\n",
    "# replace <My Endpoint String> with the string from your endpoint URL\n",
    "face_api_url = 'https://api-xyr.cognitiveservices.azure.com//face/v1.0/detect'\n",
    "\n",
    "# 请求正文body\n",
    "image_url = 'https://image.baidu.com/search/detail?ct=503316480&z=undefined&tn=baiduimagedetail&ipn=d&word=%E9%87%91%E6%99%BA%E7%A7%80&step_word=&ie=utf-8&in=&cl=2&lm=-1&st=undefined&hd=undefined&latest=undefined&copyright=undefined&cs=574867687,4052592753&os=1341029865,3039434380&simid=0,0&pn=0&rn=1&di=54450&ln=30&fr=&fmq=1604325156203_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&is=0,0&istype=0&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=0&objurl=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201803%2F17%2F20180317084047_ReUYF.thumb.700_0.jpeg&rpstart=0&rpnum=0&adpicid=0&force=undefined'\n",
    "\n",
    "headers = {'Ocp-Apim-Subscription-Key': subscription_key}\n",
    "\n",
    "# 请求参数parameters\n",
    "params = {\n",
    "    'returnFaceId': 'true',\n",
    "    'returnFaceLandmarks': 'false',\n",
    "    # 可选参数,请仔细阅读API文档\n",
    "    'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise',\n",
    "}\n",
    "\n",
    "response = requests.post(face_api_url, params=params,\n",
    "                         headers=headers, json={\"url\": image_url})\n",
    "# json.dumps 将json--->bytes\n",
    "json.dumps(response.json())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## json转译"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'error': {'code': 'InvalidImage',\n",
       "  'message': 'Decoding error, image format unsupported.'}}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results = response.json()\n",
    "results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## pandas 数据表格化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!conda update pandas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 315,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceRectangle.top</th>\n",
       "      <th>faceRectangle.left</th>\n",
       "      <th>faceRectangle.width</th>\n",
       "      <th>faceRectangle.height</th>\n",
       "      <th>faceAttributes.smile</th>\n",
       "      <th>faceAttributes.headPose.pitch</th>\n",
       "      <th>faceAttributes.headPose.roll</th>\n",
       "      <th>faceAttributes.headPose.yaw</th>\n",
       "      <th>faceAttributes.gender</th>\n",
       "      <th>...</th>\n",
       "      <th>faceAttributes.noise.value</th>\n",
       "      <th>faceAttributes.makeup.eyeMakeup</th>\n",
       "      <th>faceAttributes.makeup.lipMakeup</th>\n",
       "      <th>faceAttributes.accessories</th>\n",
       "      <th>faceAttributes.occlusion.foreheadOccluded</th>\n",
       "      <th>faceAttributes.occlusion.eyeOccluded</th>\n",
       "      <th>faceAttributes.occlusion.mouthOccluded</th>\n",
       "      <th>faceAttributes.hair.bald</th>\n",
       "      <th>faceAttributes.hair.invisible</th>\n",
       "      <th>faceAttributes.hair.hairColor</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>e60e777d-49a1-4b0c-bbbb-602774a12558</td>\n",
       "      <td>118</td>\n",
       "      <td>144</td>\n",
       "      <td>88</td>\n",
       "      <td>88</td>\n",
       "      <td>0.813</td>\n",
       "      <td>-3.4</td>\n",
       "      <td>1.4</td>\n",
       "      <td>9.4</td>\n",
       "      <td>male</td>\n",
       "      <td>...</td>\n",
       "      <td>0.01</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0.18</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'color': 'brown', 'confidence': 0.95}, {'col...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>e77bcf66-f74e-4d25-a9c7-b57edbbb2d6d</td>\n",
       "      <td>117</td>\n",
       "      <td>376</td>\n",
       "      <td>64</td>\n",
       "      <td>64</td>\n",
       "      <td>0.456</td>\n",
       "      <td>-1.1</td>\n",
       "      <td>-0.2</td>\n",
       "      <td>6.6</td>\n",
       "      <td>female</td>\n",
       "      <td>...</td>\n",
       "      <td>0.01</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0.08</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'color': 'black', 'confidence': 1.0}, {'colo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>361ce510-b55e-4362-9e9d-40c05d36ab68</td>\n",
       "      <td>41</td>\n",
       "      <td>676</td>\n",
       "      <td>52</td>\n",
       "      <td>52</td>\n",
       "      <td>1.000</td>\n",
       "      <td>3.0</td>\n",
       "      <td>-1.3</td>\n",
       "      <td>-0.6</td>\n",
       "      <td>male</td>\n",
       "      <td>...</td>\n",
       "      <td>0.07</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'type': 'glasses', 'confidence': 1.0}]</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0.06</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'color': 'black', 'confidence': 0.98}, {'col...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>ccf371a8-f4ff-41e5-b33c-a6d935167830</td>\n",
       "      <td>69</td>\n",
       "      <td>445</td>\n",
       "      <td>52</td>\n",
       "      <td>52</td>\n",
       "      <td>1.000</td>\n",
       "      <td>0.2</td>\n",
       "      <td>2.6</td>\n",
       "      <td>1.5</td>\n",
       "      <td>female</td>\n",
       "      <td>...</td>\n",
       "      <td>0.33</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0.11</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'color': 'black', 'confidence': 1.0}, {'colo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>99be7f99-ddcb-43f2-a57b-58b1f25a693b</td>\n",
       "      <td>95</td>\n",
       "      <td>238</td>\n",
       "      <td>51</td>\n",
       "      <td>51</td>\n",
       "      <td>0.981</td>\n",
       "      <td>7.2</td>\n",
       "      <td>1.2</td>\n",
       "      <td>2.6</td>\n",
       "      <td>female</td>\n",
       "      <td>...</td>\n",
       "      <td>0.48</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'type': 'glasses', 'confidence': 1.0}]</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0.11</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'color': 'black', 'confidence': 0.98}, {'col...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>b50bf64f-3db7-4039-88aa-4db07ffdf266</td>\n",
       "      <td>94</td>\n",
       "      <td>540</td>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "      <td>1.000</td>\n",
       "      <td>-7.7</td>\n",
       "      <td>5.0</td>\n",
       "      <td>6.9</td>\n",
       "      <td>female</td>\n",
       "      <td>...</td>\n",
       "      <td>0.08</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0.10</td>\n",
       "      <td>False</td>\n",
       "      <td>[{'color': 'black', 'confidence': 1.0}, {'colo...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>6 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                 faceId  faceRectangle.top  \\\n",
       "0  e60e777d-49a1-4b0c-bbbb-602774a12558                118   \n",
       "1  e77bcf66-f74e-4d25-a9c7-b57edbbb2d6d                117   \n",
       "2  361ce510-b55e-4362-9e9d-40c05d36ab68                 41   \n",
       "3  ccf371a8-f4ff-41e5-b33c-a6d935167830                 69   \n",
       "4  99be7f99-ddcb-43f2-a57b-58b1f25a693b                 95   \n",
       "5  b50bf64f-3db7-4039-88aa-4db07ffdf266                 94   \n",
       "\n",
       "   faceRectangle.left  faceRectangle.width  faceRectangle.height  \\\n",
       "0                 144                   88                    88   \n",
       "1                 376                   64                    64   \n",
       "2                 676                   52                    52   \n",
       "3                 445                   52                    52   \n",
       "4                 238                   51                    51   \n",
       "5                 540                   48                    48   \n",
       "\n",
       "   faceAttributes.smile  faceAttributes.headPose.pitch  \\\n",
       "0                 0.813                           -3.4   \n",
       "1                 0.456                           -1.1   \n",
       "2                 1.000                            3.0   \n",
       "3                 1.000                            0.2   \n",
       "4                 0.981                            7.2   \n",
       "5                 1.000                           -7.7   \n",
       "\n",
       "   faceAttributes.headPose.roll  faceAttributes.headPose.yaw  \\\n",
       "0                           1.4                          9.4   \n",
       "1                          -0.2                          6.6   \n",
       "2                          -1.3                         -0.6   \n",
       "3                           2.6                          1.5   \n",
       "4                           1.2                          2.6   \n",
       "5                           5.0                          6.9   \n",
       "\n",
       "  faceAttributes.gender  ...  faceAttributes.noise.value  \\\n",
       "0                  male  ...                        0.01   \n",
       "1                female  ...                        0.01   \n",
       "2                  male  ...                        0.07   \n",
       "3                female  ...                        0.33   \n",
       "4                female  ...                        0.48   \n",
       "5                female  ...                        0.08   \n",
       "\n",
       "   faceAttributes.makeup.eyeMakeup  faceAttributes.makeup.lipMakeup  \\\n",
       "0                            False                            False   \n",
       "1                            False                             True   \n",
       "2                            False                            False   \n",
       "3                            False                            False   \n",
       "4                            False                            False   \n",
       "5                            False                            False   \n",
       "\n",
       "                 faceAttributes.accessories  \\\n",
       "0                                        []   \n",
       "1                                        []   \n",
       "2  [{'type': 'glasses', 'confidence': 1.0}]   \n",
       "3                                        []   \n",
       "4  [{'type': 'glasses', 'confidence': 1.0}]   \n",
       "5                                        []   \n",
       "\n",
       "  faceAttributes.occlusion.foreheadOccluded  \\\n",
       "0                                     False   \n",
       "1                                     False   \n",
       "2                                     False   \n",
       "3                                     False   \n",
       "4                                     False   \n",
       "5                                     False   \n",
       "\n",
       "   faceAttributes.occlusion.eyeOccluded  \\\n",
       "0                                 False   \n",
       "1                                 False   \n",
       "2                                 False   \n",
       "3                                 False   \n",
       "4                                 False   \n",
       "5                                 False   \n",
       "\n",
       "   faceAttributes.occlusion.mouthOccluded  faceAttributes.hair.bald  \\\n",
       "0                                   False                      0.18   \n",
       "1                                   False                      0.08   \n",
       "2                                   False                      0.06   \n",
       "3                                   False                      0.11   \n",
       "4                                   False                      0.11   \n",
       "5                                   False                      0.10   \n",
       "\n",
       "   faceAttributes.hair.invisible  \\\n",
       "0                          False   \n",
       "1                          False   \n",
       "2                          False   \n",
       "3                          False   \n",
       "4                          False   \n",
       "5                          False   \n",
       "\n",
       "                       faceAttributes.hair.hairColor  \n",
       "0  [{'color': 'brown', 'confidence': 0.95}, {'col...  \n",
       "1  [{'color': 'black', 'confidence': 1.0}, {'colo...  \n",
       "2  [{'color': 'black', 'confidence': 0.98}, {'col...  \n",
       "3  [{'color': 'black', 'confidence': 1.0}, {'colo...  \n",
       "4  [{'color': 'black', 'confidence': 0.98}, {'col...  \n",
       "5  [{'color': 'black', 'confidence': 1.0}, {'colo...  \n",
       "\n",
       "[6 rows x 38 columns]"
      ]
     },
     "execution_count": 315,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd # 定义模块名字\n",
    "df_face = pd.json_normalize(results)\n",
    "df_face"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据取值 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['e60e777d-49a1-4b0c-bbbb-602774a12558',\n",
       " 'e77bcf66-f74e-4d25-a9c7-b57edbbb2d6d',\n",
       " '361ce510-b55e-4362-9e9d-40c05d36ab68',\n",
       " 'ccf371a8-f4ff-41e5-b33c-a6d935167830',\n",
       " '99be7f99-ddcb-43f2-a57b-58b1f25a693b',\n",
       " 'b50bf64f-3db7-4039-88aa-4db07ffdf266']"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "faceID = df_face['faceId'].values.tolist()\n",
    "faceID "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['faceId', 'faceRectangle.top', 'faceRectangle.left',\n",
       "       'faceRectangle.width', 'faceRectangle.height', 'faceAttributes.smile',\n",
       "       'faceAttributes.headPose.pitch', 'faceAttributes.headPose.roll',\n",
       "       'faceAttributes.headPose.yaw', 'faceAttributes.gender',\n",
       "       'faceAttributes.age', 'faceAttributes.facialHair.moustache',\n",
       "       'faceAttributes.facialHair.beard',\n",
       "       'faceAttributes.facialHair.sideburns', 'faceAttributes.glasses',\n",
       "       'faceAttributes.emotion.anger', 'faceAttributes.emotion.contempt',\n",
       "       'faceAttributes.emotion.disgust', 'faceAttributes.emotion.fear',\n",
       "       'faceAttributes.emotion.happiness', 'faceAttributes.emotion.neutral',\n",
       "       'faceAttributes.emotion.sadness', 'faceAttributes.emotion.surprise',\n",
       "       'faceAttributes.blur.blurLevel', 'faceAttributes.blur.value',\n",
       "       'faceAttributes.exposure.exposureLevel',\n",
       "       'faceAttributes.exposure.value', 'faceAttributes.noise.noiseLevel',\n",
       "       'faceAttributes.noise.value', 'faceAttributes.makeup.eyeMakeup',\n",
       "       'faceAttributes.makeup.lipMakeup', 'faceAttributes.accessories',\n",
       "       'faceAttributes.occlusion.foreheadOccluded',\n",
       "       'faceAttributes.occlusion.eyeOccluded',\n",
       "       'faceAttributes.occlusion.mouthOccluded', 'faceAttributes.hair.bald',\n",
       "       'faceAttributes.hair.invisible', 'faceAttributes.hair.hairColor'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 检查属性/特征值\n",
    "df_face.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 316,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>faceId</th>\n",
       "      <th>faceAttributes.glasses</th>\n",
       "      <th>faceAttributes.emotion.neutral</th>\n",
       "      <th>faceAttributes.age</th>\n",
       "      <th>faceAttributes.gender</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>e60e777d-49a1-4b0c-bbbb-602774a12558</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>0.184</td>\n",
       "      <td>19.0</td>\n",
       "      <td>male</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>e77bcf66-f74e-4d25-a9c7-b57edbbb2d6d</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>0.542</td>\n",
       "      <td>22.0</td>\n",
       "      <td>female</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>361ce510-b55e-4362-9e9d-40c05d36ab68</td>\n",
       "      <td>ReadingGlasses</td>\n",
       "      <td>0.000</td>\n",
       "      <td>25.0</td>\n",
       "      <td>male</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>ccf371a8-f4ff-41e5-b33c-a6d935167830</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>0.000</td>\n",
       "      <td>23.0</td>\n",
       "      <td>female</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>99be7f99-ddcb-43f2-a57b-58b1f25a693b</td>\n",
       "      <td>ReadingGlasses</td>\n",
       "      <td>0.019</td>\n",
       "      <td>18.0</td>\n",
       "      <td>female</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>b50bf64f-3db7-4039-88aa-4db07ffdf266</td>\n",
       "      <td>NoGlasses</td>\n",
       "      <td>0.000</td>\n",
       "      <td>19.0</td>\n",
       "      <td>female</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                 faceId faceAttributes.glasses  \\\n",
       "0  e60e777d-49a1-4b0c-bbbb-602774a12558              NoGlasses   \n",
       "1  e77bcf66-f74e-4d25-a9c7-b57edbbb2d6d              NoGlasses   \n",
       "2  361ce510-b55e-4362-9e9d-40c05d36ab68         ReadingGlasses   \n",
       "3  ccf371a8-f4ff-41e5-b33c-a6d935167830              NoGlasses   \n",
       "4  99be7f99-ddcb-43f2-a57b-58b1f25a693b         ReadingGlasses   \n",
       "5  b50bf64f-3db7-4039-88aa-4db07ffdf266              NoGlasses   \n",
       "\n",
       "   faceAttributes.emotion.neutral  faceAttributes.age faceAttributes.gender  \n",
       "0                           0.184                19.0                  male  \n",
       "1                           0.542                22.0                female  \n",
       "2                           0.000                25.0                  male  \n",
       "3                           0.000                23.0                female  \n",
       "4                           0.019                18.0                female  \n",
       "5                           0.000                19.0                female  "
      ]
     },
     "execution_count": 316,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可观察其中几组数据\n",
    "df_face[['faceId','faceAttributes.glasses','faceAttributes.emotion.neutral','faceAttributes.age','faceAttributes.gender']]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": true,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "304.313px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
